package com.sardine.base.design;

import com.sardine.base.design.api.IContextConfig;
import com.sardine.base.design.api.ListenerHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;
import java.util.Map;

/**
 * 上海京东到家元信信息技术有限公司<br>
 * Created with IntelliJ IDEA.
 * Date:2017/10/9
 * Time:15:40
 * 上下文配置对象
 * @author daifeng<br>
 *         daifeng@imdada.cn
 * @since JDK 1.7 <br>
 * Copyright (c) 2017 imdada System Incorporated All Rights Reserved.
 */
public class ContextConfig implements IContextConfig {
    private static final Logger logger = LoggerFactory.getLogger(ContextConfig.class);

    private Map<String, List<ListenerHandler>> map;

    public ContextConfig(Map<String, List<ListenerHandler>> map) {
        this.map = map;
    }
    /**
     * 得到一个执行组件
     *
     * @param eventType
     * @return
     */
    @Override
    public List<ListenerHandler> getCommend(String eventType) {
        List<ListenerHandler> listenerHandlers = map.get(eventType);
        return listenerHandlers;
    }
}
